﻿
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
    <input id="fileSelector" type="file">
    <input type="button" name="" id="btn" value="tijaio" />
</body>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
     $("#btn").click(function () {
        var file = document.getElementById('fileSelector').files[0];
        var filename = file.name;
        var data = { "isUp": "1", "fileFullName": filename };
        $.ajax({
            type: "post",
            dataType: "json",
            data: JSON.stringify(data),
            url: "http://oa.romens.cn:8087/FileSign",
            success: function (data) {
                var url = data.url;
                var xhr = new XMLHttpRequest();

                xhr.open("put", url, true);

                xhr.onload = function () {
                    if (xhr.status === 200 || xhr.status === 206) {
                        var ETag = xhr.getResponseHeader('etag');
                        console.log("上传成功！");
                    } else {
                        callback('文件 ' + Key + ' 上传失败，状态码：' + xhr.status);
                    }

                };

                xhr.send(file);
            }
        })
    })
</script>
</html>
